package com.by.common.controller;

import com.by.common.bean.ResultBean;

public class BaseController {

    protected ResultBean success(String msg){
        return handler(ApiCode.SUCCESS,msg,null);
    }

    protected ResultBean success(String msg,Object data){
        return handler(ApiCode.SUCCESS,msg,data);
    }

    protected ResultBean fail(String msg){
        return handler(ApiCode.FAIL,msg,null);
    }

    protected ResultBean fail(String msg,Object data){
        return handler(ApiCode.FAIL,msg,data);
    }

    ResultBean handler(int code,String msg,Object data){
        return new ResultBean(code,msg,data);
    }
}
